﻿using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
namespace ugui.demo1
{
    public class enterEventCamera : MonoBehaviour,

        IPointerEnterHandler,
        IPointerDownHandler

    {
        //鼠标指针从该Widget刚进入触发
        public void OnPointerEnter(PointerEventData eventData)
        {
            //6 eventData.enterEventCamera：这个事件是由哪个摄像机执行的
            //test result:widget所属的Canvas RenderMode为Screen Space-Camera 并且Render Camera不为空
            Debug.LogError(gameObject.name+ " OnPointerEnter eventData.enterEventCamera:" + eventData.enterEventCamera);

            //7 ???????
            foreach(GameObject o in eventData.hovered)
            {
                Debug.LogError(gameObject.name + " OnPointerEnter eventData.hovered:" + o.name);
            }
        }
        public void OnPointerDown(PointerEventData eventData)
        {
            //6 eventData.pressEventCamera：这个事件是由哪个摄像机执行的
            //test result:widget所属的Canvas RenderMode为Screen Space-Camera 并且Render Camera不为空
            Debug.LogError(gameObject.name + " OnPointerDown eventData.pressEventCamera:" + eventData.pressEventCamera);
        }
    }
}
